package cn.h8k.hj212.entity;

import java.util.Objects;

/**
 * HJ212协议消息头部实体类
 * 包含协议头部信息
 */
public class Hj212Header {
    
    /**
     * 协议头标识，固定为"##"
     */
    private String head;
    
    /**
     * 数据长度，4位数字
     */
    private String length;
    
    /**
     * 默认构造函数
     */
    public Hj212Header() {
        this.head = "##";
    }
    
    /**
     * 构造函数
     * @param head 协议头标识
     * @param length 数据长度
     */
    public Hj212Header(String head, String length) {
        this.head = head;
        this.length = length;
    }
    
    public String getHead() {
        return head;
    }
    
    public void setHead(String head) {
        this.head = head;
    }
    
    public String getLength() {
        return length;
    }
    
    public void setLength(String length) {
        this.length = length;
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Hj212Header that = (Hj212Header) o;
        return Objects.equals(head, that.head) &&
               Objects.equals(length, that.length);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(head, length);
    }
    
    @Override
    public String toString() {
        return "Hj212Header{" +
                "head='" + head + '\'' +
                ", length='" + length + '\'' +
                '}';
    }
} 